﻿@using CMS.Common.Helpers;
@model CMSApplication.Models.UserModel
@{
    Layout = null;
    string returnUrlstring=string.Empty;
    if (!string.IsNullOrEmpty(Request.QueryString["returnUrl"]))
    {
        returnUrlstring = Request.QueryString["returnUrl"].ToString();
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <title>Administration - Control Panel</title>
    <link href="@Url.Content("~/Content/css/stylesheets.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/css/login.css")" rel="stylesheet" type="text/css" />
    <script src="../../Content/js/jquery.min.js"></script>
</head>
<body>
    <div class="registerBox">
        <div class="registerHead">
            <img src="@Url.Content("~/Content/img/logo.png")" alt="Aquarius -  responsive admin panel" title="Aquarius -  responsive admin panel"/>
        </div>
            <div class="control-group">
                <label for="inputEmail">
                    Full name</label>
                @Html.TextBoxFor(m => m.FullName, new { @placeholder = "Full name", @class = "inputFullName"})
                @Html.ValidationMessageFor(m => m.UserName)
            </div>
            <div class="control-group">
                <label for="inputEmail">
                    Email</label>
                @Html.TextBoxFor(m => m.Email, new { @placeholder = "Emai", @class = "inputEmail" })
                @Html.ValidationMessageFor(m => m.UserName)
            </div>
            <div class="control-group">
                <label for="inputEmail">
                    User name</label>
                @Html.TextBoxFor(m => m.UserName, new { @placeholder = "UserName", @class = "inputUserName" })
                @Html.ValidationMessageFor(m => m.UserName)
            </div>
            <div class="control-group">
                <label for="inputEmail">
                    Password</label>
                @Html.PasswordFor(m => m.Password, new { @placeholder = "Password", @class = "inputPassword" })
                @Html.ValidationMessageFor(m => m.Password)
            </div>
            <div class="control-group">
                <label for="inputEmail">
                    Description</label>
                 @Html.TextAreaFor(model => Model.Description, new { @style = "width:95%; height:100px", @class="inputDes"})
                        @Html.ValidationMessageFor(model => model.Description)
            </div>
            <div class="control-group">
                <label for="inputEmail">
                    Address</label>
                 @Html.TextBoxFor(model => Model.Address, new { @class = "inputAddress" })
                        @Html.ValidationMessageFor(model => model.Address)
            </div>
            <div class="control-group" style="margin-bottom: 5px;">
                <label><span style="color:red" class="error-msg"></span></label>
            </div>
            <div class="form-actions">
            <input type="button" value="Sign up" class="btn submit-btn" /> <input type="button" value="Cancel" class="btn" />
            </div>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".submit-btn").click(function () {
                $.post("/User/AddUser", {
                    FullName: $(".inputFullName").val(),
                    Email: $(".inputEmail").val(),
                    UserName: $(".inputUserName").val(),
                    Password: $(".inputPassword").val(),
                    Description: $(".inputDes").val(),
                    Address: $(".inputAddress").val()
                }, function (data) {
                    var msg = eval(data);
                    $(".error-msg").html(msg.Message);s
                })
            })
        })
    </script>
</body>
</html>
